home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / doslynx / src / turlvie3.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  2.8 KB  |  98 lines

  1. //    Copyright (c) 1993, University of Kansas, All Rights Reserved
  2. //
  3. //    Class:        TURLView
  4. //    Include File:    turlview.h
  5. //    Purpose:    Provide the view of a URL
  6. //    Remarks/Portability/Dependencies/Restrictions:
  7. //    Revision History:
  8. //        12-27-93    created
  9. //        02-02-94    Began a major revision to fully handle a
  10. //                multiple document interface with WWW, take
  11. //                over the formatting and drawing of the
  12. //                old gridtext functions of HText, and optimize
  13. //                memory usage, selecting anchors, the usage of
  14. //                HText's new image file.  See gridtext.
  15. //        02-09-94    Split all members into seperate files.
  16. #include"turlview.h"
  17. #include"trace.h"
  18. #include"urltodos.h"
  19. #include<string.h>
  20.  
  21. TURLView::~TURLView()    {
  22. //    Purpose:    Destructor
  23. //    Arguments:    void
  24. //    Remarks/Portability/Dependencies/Restrictions:
  25. //        Memory possible allocated by isImage in the cp_imagename
  26. //        member is not our responsibility.  Other DosLynx code must
  27. //        free it when it is ready.
  28. //    Revision History:
  29. //        01-10-94    created
  30. #ifndef RELEASE
  31.     trace("Destorying view.");
  32. #endif // RELEASE
  33.     //    If a valid HText is in the view, set it to know that one less
  34.     //    view is now accessing it.
  35.     if(HTp_HyperDoc != NULL)    {
  36. #ifndef RELEASE
  37.         trace("Adjusting HText for one less view.");
  38. #endif // RELEASE
  39.         HTp_HyperDoc->usi_Views--;
  40.  
  41.         //    Here we manually get rid of the hotlist if there
  42.         //    are no views looking at it.
  43.         if(HTp_HyperDoc->usi_Views == 0 && cp_HotList != NULL &&
  44.             *cp_HotList != '\0' && URLisLocal(getURL()) == 1)
  45.         {
  46.             //    Convert the hotlist to a URL.
  47.             auto char ca_dosurl[usi_TILURLSize];
  48.             dostourl(ca_dosurl, cp_HotList);
  49.  
  50.             //    Compare the names.
  51.             if(0 == stricmp(getURL(), ca_dosurl))    {
  52.                 //    This is the HotList, get rid of it.
  53.                 HText_free(HTp_HyperDoc);
  54.             }
  55.         }
  56.     }
  57.  
  58.     //    Free our line collection.
  59.     //    There is in fact, no memory allocated, remove all items
  60.     //    before destroying.
  61.     if(TNSCp_lines != NULL)    {
  62. #ifndef RELEASE
  63.         trace("Freeing off line collection.");
  64. #endif // RELEASE
  65.         if(TNSCp_lines->getCount() != 0)    {
  66.             TNSCp_lines->removeAll();
  67.         }
  68.         destroy(TNSCp_lines);
  69.     }
  70.  
  71.     //    Free the anchor collection, one by one.
  72.     if(TNSCp_anchors != NULL)    {
  73. #ifndef RELEASE
  74.         trace("Freeing off anchor collection.");
  75.         trace(TNSCp_anchors->getCount() << " entries.");
  76. #endif // RELEASE
  77.         auto TextAttribute *TAp_free;
  78.         for(signed short int ssi_free = 0; ssi_free <
  79.             TNSCp_anchors->getCount(); ssi_free++)    {
  80.             TAp_free = (TextAttribute *)(TNSCp_anchors->
  81.                 at(ssi_free));
  82.             delete(TAp_free);
  83.         }
  84.         if(TNSCp_anchors->getCount() != 0)    {
  85.             TNSCp_anchors->removeAll();
  86.         }
  87.         destroy(TNSCp_anchors);
  88.     }
  89.  
  90.     //    If it exists, free the search attribute.
  91.     if(TAp_search != NULL)    {
  92. #ifndef RELEASE
  93.         trace("Freeing off search attribute.");
  94. #endif // RELEASE
  95.         delete(TAp_search);
  96.     }
  97. }
  98.